﻿using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.IU;
using NP.BPMReportPlatform.SceneSalesTechDoc.Dtos;
using NP.BPMReportPlatform.SeminarManage;
using NP.BPMReportPlatform.SeminarManage.Dtos;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.SceneSalesTechDoc
{
    //[Authorize]
    [ApiController]
    [Route("api/tuc")]
    public class TUCSceneSalesTechDocController : BPMReportPlatformController
    {
        private readonly ITUCSceneSalesTechDocService _sceneSalesTechDocService;
        public TUCSceneSalesTechDocController(ITUCSceneSalesTechDocService sceneSalesTechDocService)
        {
            this._sceneSalesTechDocService = sceneSalesTechDocService;
        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("TUCSceneSalesTechDoc/GetAllAsync")]
        public async Task<PagedResultDto<TUCSceneSalesTechDocOutput>> GetAllAsync([FromBody] TUCSceneSalesTechDocInput input)
        {
            return await _sceneSalesTechDocService.GetAllAsync(input);
        }

        /// <summary>
        /// 导出
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("TUCSceneSalesTechDoc/ExportAsync")]
        public async Task<XlsxFileResult<TUCSceneSalesTechDocOutput>> Export1Async(TUCSceneSalesTechDocInput input)
        {
            var rst =await _sceneSalesTechDocService.Export1Async(input);
            return new XlsxFileResult<TUCSceneSalesTechDocOutput>(rst, "导出Excel");
        }

        /// <summary>
        /// 设置作废状态
        /// </summary>
        /// <param name="orderNum"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("TUCSceneSalesTechDoc/SetStatus")]
        public async Task<bool> SetStatus([FromQuery] string orderNum)
        {
            return await _sceneSalesTechDocService.SetStatus(orderNum);
        }

        /// <summary>
        /// 获取查询条件配置
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [Route("TUCSceneSalesTechDoc/GetArea")]
        public async Task<List<AreaOutput>> GetArea()
        {
            return await _sceneSalesTechDocService.GetArea();
        }
    }
}
